package com.huaxin.hxenum.typehandler;

import com.huaxin.hxenum.base.BaseCodeEnumTypeHandler;
import com.huaxin.hxenum.enums.Priority;
import org.apache.ibatis.type.JdbcType;
import org.apache.ibatis.type.MappedTypes;

import java.sql.PreparedStatement;
import java.sql.SQLException;

@MappedTypes(Priority.class)
public class PriorityHandler extends BaseCodeEnumTypeHandler<Priority, Integer> {

    public PriorityHandler() {
        super(Priority.class);
    }

    @Override
    public void setNonNullParameter(PreparedStatement ps, int i, Priority parameter, JdbcType jdbcType) throws SQLException {
        ps.setInt(i, parameter.getCode());
    }
}